home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ For TASM / USRGUIDE.PAK / HELLO.ASM < prev    next >
Assembly Source File  |  1996-02-21  |  2KB  |  48 lines

  1. ; Turbo Assembler example. Copyright (c) 1993 By Borland International, Inc.
  2.  
  3. ; From the Turbo Assembler User's Guide - Getting started
  4.  
  5. .MODEL  SMALL
  6. .STACK  100h
  7. .DATA
  8.  
  9. TimePrompt              DB 'Is it after 12 noon (Y/N)?$'
  10. GoodMorningMessage      DB  13,10,'Good morning, world!',13,10,'$'
  11. GoodAfternoonMessage    DB  13,10,'Good afternoon, world!',13,10,'$'
  12. DefaultMessage          DB  13,10,'Good day, world!',10,13,'$'
  13.  
  14. .CODE
  15. start:
  16.   mov     ax,@data
  17.   mov     ds,ax                   ;set DS to point to the data segment
  18.   mov     dx,OFFSET TimePrompt    ;point to the time prompt
  19.   mov     ah,9                    ;DOS: print string
  20.   int     21h                     ;display the time prompt
  21.   mov     ah,1                    ;DOS: get character
  22.   int     21h                     ;get a single-character response
  23.   or      al,20h                  ;force character to lower case
  24.  
  25.   cmp     al,'y'                  ;typed Y for afternoon?
  26.   je      IsAfternoon
  27.   cmp     al,'n'                  ;typed N for morning?
  28.   je      IsMorning
  29.  
  30.   mov     dx,OFFSET DefaultMessage            ;default greeting
  31.   jmp     DisplayGreeting
  32.  
  33. IsAfternoon:
  34.   mov     dx,OFFSET GoodAfternoonMessage      ;afternoon greeting
  35.   jmp     DisplayGreeting
  36.  
  37. IsMorning:
  38.   mov     dx,OFFSET GoodMorningMessage        ;before noon greeting
  39.  
  40. DisplayGreeting:
  41.   mov     ah,9                    ;DOS: print string
  42.   int     21h                     ;display the appropriate greeting
  43.   mov     ah,4ch                  ;DOS: terminate program
  44.   mov     al,0                    ;return code will be 0
  45.   int     21h                     ;terminate the program
  46.  
  47. END start
  48.